Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ts config and package update for fixing reference #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/boilerplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,19 @@ const defaultTSConfig = {
"target": "ES5",
"module": "commonjs",
"lib": [
"es2015"
"es2015",
"DOM" // for use console
],
"removeComments": false,
"skipLibCheck": true,
"sourceMap": false
}
"sourceMap": false,
"esModuleInterop": true
},
"include": [
"scripts/**/*", // typescripts
"node_modules/autojs-dev/types/auto.d.ts" // auto file types
],
"exclude": []
};

const autojsConfig = {
Expand Down Expand Up @@ -93,6 +100,8 @@ function Boilerplate(name: string, isModule: boolean) {
description: "A Auto.js Script Project.",
devDependencies: {
"autojs-dev": JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8')).version,
"ts-loader": JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'))["dependencies"]["ts-loader"], // 如果需要使用node scripts,则新建项目里需要拥有ts-loader和url-loader
"url-loader": JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'))["dependencies"]["url-loader"],
},
author: "",
license: "GPL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion template/script.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script>
/// <reference path="./node_modules/autojs-dev/types/autojs.d.ts" />

<%=(module ? 'export' : '') %> class <%=name %> {
constructor(){
Expand All @@ -14,4 +13,5 @@
<% if(!module){ %>
<%=name %>.main();
<% } %>

</script>
3 changes: 3 additions & 0 deletions types/modules/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ declare function exit(): void;
declare function random(): number;
declare function random(min: number, max: number): number;

// for url-loader load img
declare module '*.png'
declare module '*.jpg'