-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #975 from EhTagTranslation/esm
Upgrade to ESM
- Loading branch information
Showing
104 changed files
with
615 additions
and
473 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,9 @@ | |
/dist | ||
/db | ||
/scripts | ||
*.config.js | ||
*.config.{js,ts} | ||
.*.{js,ts} | ||
/test/ | ||
|
||
# packages | ||
/node_modules/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ lerna-debug.log* | |
.DS_Store | ||
|
||
# Tests | ||
/coverage | ||
coverage/ | ||
/.nyc_output | ||
|
||
# IDEs and editors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// @ts-check | ||
import ResolveTypeScriptPlugin from 'resolve-typescript-plugin'; | ||
|
||
/** | ||
* | ||
* @param {import('webpack').Configuration} config | ||
* @param {import('@angular-builders/custom-webpack').CustomWebpackBrowserSchema} options | ||
* @param {import('@angular-builders/custom-webpack').TargetOptions} targetOptions | ||
* @returns {import('webpack').Configuration} | ||
*/ | ||
export default function (config, options, targetOptions) { | ||
config.resolve ??= {}; | ||
config.resolve.plugins ??= []; | ||
config.resolve.plugins.push(new ResolveTypeScriptPlugin()); | ||
return config; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
const fs = require('fs-extra'); | ||
const { exportVariable } = require('@actions/core'); | ||
// @ts-check | ||
import fs from 'fs-extra'; | ||
import { exportVariable } from '@actions/core'; | ||
|
||
/** @type {import('type-fest').PackageJson} */ | ||
const packageJson = fs.readJSONSync('./package.json'); | ||
const packageJson = await fs.readJSON('./package.json'); | ||
exportVariable('PACKAGE_VERSION', packageJson.version); | ||
exportVariable('PACKAGE_NAME', packageJson.name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,29 @@ | ||
const fs = require('fs-extra'); | ||
// @ts-check | ||
import fs from 'fs-extra'; | ||
|
||
const removedPackages = ['lazysizes', 'zone.js']; | ||
const removedPackageHeaders = ['@angular', 'angular', '@nestjs/', 'fastify']; | ||
|
||
/** @type {import('type-fest').PackageJson} */ | ||
const packageJson = fs.readJSONSync('./package.json'); | ||
packageJson.scripts = { | ||
start: 'node ./index.js', | ||
}; | ||
const packageJson = await fs.readJSON('./package.json'); | ||
packageJson.scripts = undefined; | ||
packageJson.devDependencies = undefined; | ||
for (const key in packageJson.dependencies) { | ||
if (removedPackageHeaders.some((leading) => key.startsWith(leading)) || removedPackages.includes(key)) { | ||
packageJson.dependencies[key] = undefined; | ||
} | ||
} | ||
fs.writeJSONSync('./dist/package.json', packageJson); | ||
fs.writeFileSync('./dist/index.js', 'require("./tool")'); | ||
for (const key in packageJson.imports) { | ||
const value = packageJson.imports[key]; | ||
if (typeof value == 'string') { | ||
packageJson.imports[key] = value.replace(/^.\/dist\//, './'); | ||
} | ||
} | ||
for (const key in /** @type {object} */ (packageJson.exports)) { | ||
const value = packageJson.exports[key]; | ||
if (typeof value == 'string') { | ||
packageJson.exports[key] = value.replace(/^.\/dist\//, './'); | ||
} | ||
} | ||
await fs.writeJSON('./dist/package.json', packageJson); | ||
await fs.writeFile('./dist/index.js', 'import "./tool/index.js";'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.