diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..d86d746 --- /dev/null +++ b/.npmignore @@ -0,0 +1,4 @@ +* +!README.md +!src/lib/README.md +!dist/**/* \ No newline at end of file diff --git a/package.json b/package.json index f1700ba..4e689e6 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,27 @@ { - "name": "cms", - "private": true, - "version": "0.1.0", - "description": "A Strapi application", + "name": "@cowprotocol/cms", + "version": "0.1.0-rc.0", + "description": "Cow Protocol CMS", + "main": "dist/lib.js", + "types": "dist/lib.d.ts", + "source": "src/lib.ts", + "exports": { + "require": "./dist/lib.js", + "default": "./dist/lib.js" + }, + "license": "(MIT OR Apache-2.0)", "scripts": { "dev": "strapi develop", "start": "strapi start", - "build": "strapi build", + "build": "npm run types && npm run build:strapi && npm run build:lib", + "build:strapi": "npx tsc -p tsconfig.lib.json", + "build:lib": "npx tsc -p tsconfig.lib.json", "strapi": "strapi", - "types": "npm run types:prod", - "types:local": "npx openapi-typescript http://localhost:1337/api/docs/openapi.json -o src/gen/types.ts", - "types:prod": "npx openapi-typescript https://cms.cow.fi/api/docs/openapi.json -o src/gen/types.ts" + "types": "npx openapi-typescript src/extensions/documentation/documentation/1.0.0/full_documentation.json -o src/gen/types.ts", + "prepublish": "npm run build" }, - "devDependencies": {}, - "dependencies": { + "dependencies": {}, + "devDependencies": { "@strapi/plugin-documentation": "4.13.3", "@strapi/plugin-i18n": "4.13.3", "@strapi/plugin-users-permissions": "4.13.3", @@ -31,6 +39,5 @@ "engines": { "node": ">=16.0.0 <=20.x.x", "npm": ">=6.0.0" - }, - "license": "MIT" + } } diff --git a/src/lib.ts b/src/lib.ts new file mode 100644 index 0000000..c27bf79 --- /dev/null +++ b/src/lib.ts @@ -0,0 +1 @@ +export * from "./gen/types"; diff --git a/tsconfig.lib.json b/tsconfig.lib.json new file mode 100644 index 0000000..d05a496 --- /dev/null +++ b/tsconfig.lib.json @@ -0,0 +1,22 @@ +{ + "include": ["src/lib.ts", "src/gen/**/*"], + "exclude": ["node_modules"], + "compilerOptions": { + "outDir": "./dist", + "target": "es2016", + "module": "commonjs", + "lib": ["es2018", "dom"], + "sourceMap": true, + "declaration": true, + "moduleResolution": "node", + "esModuleInterop": true, + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": true, + "noImplicitReturns": true, + "noUnusedParameters": true, + "strictNullChecks": true + } +}