Skip to content

Commit 25fbdf8

Browse files
committed
v2.0.2
1 parent bce733a commit 25fbdf8

File tree

9 files changed

+33
-34
lines changed

9 files changed

+33
-34
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div align="center">
44
<h3>
55
Lost for easy making Construct 3 Addons. <br />
6-
v2.0.0
6+
v2.0.2
77
</h3>
88
</div>
99

addon_base/behavior/behavior.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ const BEHAVIOR_CLASS = SDK.Plugins[ADDON_ID] = class LostBehavior extends SDK.IB
2929
SCRIPTS.forEach(script => {
3030
const scriptPath = (script.language === 'ts') ? script.relativePath.replace('.ts', '.js') : script.relativePath;
3131
if (script.scriptType) {
32-
this._info.AddFileDependency({ filename: `scripts/${scriptPath}`, type: script.dependencyType, scriptType: script.scriptType });
32+
this._info.AddFileDependency({ filename: `scripts${scriptPath}`, type: script.dependencyType, scriptType: script.scriptType });
3333
}
3434
else {
35-
this._info.AddFileDependency({ filename: `scripts/${scriptPath}`, type: script.dependencyType });
35+
this._info.AddFileDependency({ filename: `scripts${scriptPath}`, type: script.dependencyType });
3636
}
3737
});
3838
FILES.forEach(file => {

addon_base/plugin/plugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ const PLUGIN_CLASS = SDK.Plugins[ADDON_ID] = class LostPlugin extends SDK.IPlugi
2929
SCRIPTS.forEach(script => {
3030
const scriptPath = (script.language === 'ts') ? script.relativePath.replace('.ts', '.js') : script.relativePath;
3131
if (script.scriptType) {
32-
this._info.AddFileDependency({ filename: `scripts/${scriptPath}`, type: script.dependencyType, scriptType: script.scriptType });
32+
this._info.AddFileDependency({ filename: `scripts${scriptPath}`, type: script.dependencyType, scriptType: script.scriptType });
3333
}
3434
else {
35-
this._info.AddFileDependency({ filename: `scripts/${scriptPath}`, type: script.dependencyType });
35+
this._info.AddFileDependency({ filename: `scripts${scriptPath}`, type: script.dependencyType });
3636
}
3737
});
3838
FILES.forEach(file => {

cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Colors } from "./deps.ts";
66
import { build } from "./cli/main.ts";
77
import { serveAddon } from './cli/serve-addon.ts';
88

9-
const VERSION = '2.0.1'
9+
const VERSION = '2.0.2'
1010

1111
type LostCommand = 'none' | 'help' | 'version' | 'build' | 'create' | 'serve';
1212

cli/behavior/create-addon-behavior-structure.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import type { AddonModule } from '../get-addon-modules.ts';
88
import type { AddonIcon } from "../get-addon-icon.ts";
99

1010
import { ADDON_BASE_URL, BUILD_PATH } from "../paths.ts";
11-
import { Project } from "../cli-deps.ts";
1211
import { path } from '../../deps.ts';
1312
import { LOGGER } from '../misc.ts';
13+
import { transpileTsToJs } from '../misc/transpile-ts-to-js.ts';
1414

1515
const ADDON_FILES = {
1616
behavior: [
@@ -206,16 +206,4 @@ function serializeEntities(categories: CategoryClassType[]) {
206206
Conditions: serializeObjectWithFunctions(conditions),
207207
Expressions: serializeObjectWithFunctions(expressions)
208208
}
209-
}
210-
211-
async function transpileTsToJs(filePath: string): Promise<string | null> {
212-
const project = new Project({
213-
compilerOptions: {
214-
target: 8,
215-
module: 7
216-
}
217-
});
218-
const sourceFile = project.addSourceFileAtPath(filePath);
219-
const transpiled = sourceFile.getEmitOutput().getOutputFiles()[0]?.getText();
220-
return transpiled || null;
221209
}

cli/get-addon-scripts.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,21 @@ export async function getAddonScripts(config: LostConfig<'plugin' | 'behavior'>)
3434
const basePath = 'Addon/Scripts';
3535
const relativePathIndex = path.indexOf(basePath);
3636

37+
const relativePath = path.substring(relativePathIndex + basePath.length + 1);
38+
3739
scripts.push({
3840
filename: entry.name,
3941
scriptType: (scriptInConfig && scriptInConfig.Type === 'external-dom-script' && scriptInConfig.ScriptType) ? scriptInConfig.ScriptType : undefined,
4042
path: `${path}/${entry.name}`,
41-
relativePath: `${path.substring(relativePathIndex + basePath.length + 1)}/${entry.name}`,
43+
relativePath: `${relativePath}/${entry.name}`,
44+
dependencyType: (scriptInConfig) ? scriptInConfig.Type : 'external-dom-script',
45+
language: language
46+
})
47+
console.log({
48+
filename: entry.name,
49+
scriptType: (scriptInConfig && scriptInConfig.Type === 'external-dom-script' && scriptInConfig.ScriptType) ? scriptInConfig.ScriptType : undefined,
50+
path: `${path}/${entry.name}`,
51+
relativePath: `${relativePath}/${entry.name}`,
4252
dependencyType: (scriptInConfig) ? scriptInConfig.Type : 'external-dom-script',
4353
language: language
4454
})

cli/misc/transpile-ts-to-js.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Project } from "../cli-deps.ts";
2+
3+
export async function transpileTsToJs(filePath: string): Promise<string | null> {
4+
const project = new Project({
5+
compilerOptions: {
6+
target: 8,
7+
module: 7
8+
}
9+
});
10+
const sourceFile = project.addSourceFileAtPath(filePath);
11+
const transpiled = sourceFile.getEmitOutput().getOutputFiles()[0]?.getText();
12+
return transpiled || null;
13+
}

cli/plugin/create-addon-plugin-structure.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import type { AddonModule } from '../get-addon-modules.ts';
88
import type { AddonIcon } from "../get-addon-icon.ts";
99

1010
import { ADDON_BASE_URL, BUILD_PATH } from "../paths.ts";
11-
import { Project } from "../cli-deps.ts";
1211
import { path } from '../../deps.ts';
1312
import { LOGGER } from '../misc.ts';
13+
import { transpileTsToJs } from '../misc/transpile-ts-to-js.ts';
1414

1515
const ADDON_FILES = {
1616
plugin: [
@@ -206,16 +206,4 @@ function serializeEntities(categories: CategoryClassType[]) {
206206
Conditions: serializeObjectWithFunctions(conditions),
207207
Expressions: serializeObjectWithFunctions(expressions)
208208
}
209-
}
210-
211-
async function transpileTsToJs(filePath: string): Promise<string | null> {
212-
const project = new Project({
213-
compilerOptions: {
214-
target: 8,
215-
module: 7
216-
}
217-
});
218-
const sourceFile = project.addSourceFileAtPath(filePath);
219-
const transpiled = sourceFile.getEmitOutput().getOutputFiles()[0]?.getText();
220-
return transpiled || null;
221209
}

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lost-c3/lib",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"exports": {
55
".": "./mod.ts",
66
"./cli": "./cli.ts"

0 commit comments

Comments
 (0)