Skip to content

Commit

Permalink
✨ feat: 初步完成项目运行 和打包;
Browse files Browse the repository at this point in the history
  • Loading branch information
ruan-cat committed May 14, 2024
1 parent f0948c9 commit 55867b0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
4 changes: 4 additions & 0 deletions demos/rename-tool/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# NODE_OPTIONS='--no-warnings'
# --no-warnings=ExperimentalWarning

NODE_OPTIONS="--no-warnings=ExperimentalWarning"
8 changes: 5 additions & 3 deletions demos/rename-tool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"name": "rename-tool",
"version": "0.0.1",
"description": "",
"main": "index.js",
"main": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"dev": "nodemon",
"build": "rollup -c"
},
"bin": {
"rnt": "dist/index.js"
Expand All @@ -23,6 +24,7 @@
"nodemon": "^3.1.0",
"rollup": "^4.17.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.36.0"
"rollup-plugin-typescript2": "^0.36.0",
"tslib": "^2.6.2"
}
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
import typescript from "typescript";
// import * as tsTypes from "typescript";
import json from "@rollup/plugin-json";
import { terser } from "rollup-plugin-terser";
import typescript2 from "rollup-plugin-typescript2";

import { dependencies } from "./package.json";

const external = Object.keys(dependencies || "");
const globals = external.reduce((prev, current) => {
const newPrev = prev;

newPrev[current] = current;
return newPrev;
}, {});
// import { dependencies } from "./package.json" assert { type: "json" };
// const external = Object.keys(dependencies || "");
// const globals = external.reduce((prev, current) => {
// const newPrev = prev;
// newPrev[current] = current;
// return newPrev;
// }, {});

const defaultConfig = {
input: "./src/index.ts",
output: {
file: "./dist/index.js",
format: "cjs",
banner: "#!/usr/bin/env node",
globals,
// globals,
},
external,
// external,
plugins: [
typescript2({
exclude: "node_modules/**",
useTsconfigDeclarationDir: true,
typescript,
// typescript: tsTypes,
tsconfig: "./tsconfig.json",
}),
json(),
Expand Down
1 change: 1 addition & 0 deletions demos/rename-tool/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Command } from "commander";
import inquirer from "inquirer";
import pkg from "../package.json";

const program = new Command(pkg.name);
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 55867b0

Please sign in to comment.