diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 20b8f1c4..4404fa4f 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ng: [latest, 10] + ng: [latest, 12] name: Build app with @angular/cli steps: - uses: actions/checkout@v2 diff --git a/integrations/package.json b/integrations/package.json index fe28d9bc..939061f4 100644 --- a/integrations/package.json +++ b/integrations/package.json @@ -5,11 +5,11 @@ "description": "Some script examples", "scripts": { "build:latest": "npm run build:ng latest -prefix ../", - "build:ng10": "npm run build:ng 10 -prefix ../", + "build:ng12": "npm run build:ng 12 -prefix ../", "build:next": "npm run build:ng next -prefix ../", "test:latest": "npm run test -prefix latest", "clean": "npx rimraf ./*/", "serve:latest": "npx angular-http-server --path latest/dist/latest", - "serve:ng10": "npx angular-http-server --path ng10/dist/ng10" + "serve:ng12": "npx angular-http-server --path ng12/dist/ng12" } } diff --git a/scripts/build.js b/scripts/build.js index 01b8631b..b5a4c59d 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -1,9 +1,10 @@ //@ts-check const { promises: fsp } = require('fs'); -const { build } = require('ng-packagr'); +const packagr = require('ng-packagr'); async function buildPkg() { try { + const libPackagePath = 'src/uploadx/package.json'; const rootPackage = JSON.parse(await fsp.readFile('package.json', 'utf8')); const libPackage = {}; libPackage.name = rootPackage.name; @@ -22,11 +23,15 @@ async function buildPkg() { dest: '../../dist/uploadx', deleteDestPath: true }; - await fsp.writeFile('src/uploadx/package.json', JSON.stringify(libPackage, undefined, 2)); - await build({ project: 'src/uploadx/package.json' }); + await fsp.writeFile(libPackagePath, JSON.stringify(libPackage)); + await packagr + .ngPackagr() + .forProject(libPackagePath) + .withTsConfig('src/uploadx/tsconfig.lib.json') + .build(); await fsp.copyFile('LICENSE', 'dist/uploadx/LICENSE'); await fsp.copyFile('README.md', 'dist/uploadx/README.md'); - await fsp.unlink('src/uploadx/package.json'); + await fsp.unlink(libPackagePath); } catch (error) { console.error(error); process.exit(1); diff --git a/src/uploadx/tsconfig.lib.json b/src/uploadx/tsconfig.lib.json new file mode 100644 index 00000000..6f9eeabc --- /dev/null +++ b/src/uploadx/tsconfig.lib.json @@ -0,0 +1,25 @@ +{ + "angularCompilerOptions": { + "compilationMode": "partial", + "strictTemplates": true, + "enableResourceInlining": true + }, + "buildOnSave": false, + "compileOnSave": false, + "compilerOptions": { + "baseUrl": ".", + "target": "es2015", + "module": "es2015", + "moduleResolution": "node", + "outDir": "", + "declaration": true, + "inlineSourceMap": true, + "inlineSources": true, + "skipLibCheck": true, + "emitDecoratorMetadata": false, + "experimentalDecorators": true, + "importHelpers": true, + "lib": ["dom", "es2018"] + }, + "exclude": ["node_modules", "dist", "**/*.ngfactory.ts", "**/*.shim.ts", "**/*.spec.ts"] +}