Compare commits
No commits in common. "v0.1.0-develop.1" and "v0.0.1" have entirely different histories.
v0.1.0-dev
...
v0.0.1
|
@ -1,13 +0,0 @@
|
||||||
name: Build/Publish
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
- develop-*
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
main:
|
|
||||||
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
|
|
||||||
secrets: inherit
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"preset": [
|
|
||||||
"@lumeweb/node-library-preset"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.0.1...v0.1.0-develop.1) (2023-07-07)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* initial version ([3a8855a](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/commit/3a8855abe2fdd41bcc95e404baa81a11123719c4))
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2023 Hammer TechnologiesLLC
|
Copyright (c) <year> <copyright holders>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
|
@ -1,31 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@lumeweb/presetter-relay-plugin-preset",
|
|
||||||
"version": "0.1.0-develop.1",
|
|
||||||
"type": "module",
|
|
||||||
"main": "lib/index.js",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "gitea@git.lumeweb.com:LumeWeb/presetter-relay-plugin-preset.git"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@lumeweb/node-library-preset": "^0.2.7",
|
|
||||||
"presetter": "^4.0.1"
|
|
||||||
},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"scripts": {
|
|
||||||
"prepare": "presetter bootstrap",
|
|
||||||
"build": "run build",
|
|
||||||
"semantic-release": "semantic-release"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"read-pkg": "^8.0.0",
|
|
||||||
"semantic-release": "^21.0.7"
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib",
|
|
||||||
"templates"
|
|
||||||
]
|
|
||||||
}
|
|
87
src/index.ts
87
src/index.ts
|
@ -1,87 +0,0 @@
|
||||||
import { dirname, resolve } from "node:path";
|
|
||||||
import { fileURLToPath } from "node:url";
|
|
||||||
import {
|
|
||||||
loadFile,
|
|
||||||
template,
|
|
||||||
PresetAsset,
|
|
||||||
PresetContext,
|
|
||||||
resolveDirective,
|
|
||||||
} from "presetter";
|
|
||||||
import { readPackage } from "read-pkg";
|
|
||||||
|
|
||||||
const DIR = fileURLToPath(dirname(import.meta.url));
|
|
||||||
|
|
||||||
// paths to the template directory
|
|
||||||
const TEMPLATES = resolve(DIR, "..", "templates");
|
|
||||||
|
|
||||||
/** List of configurable variables */
|
|
||||||
export type Variable = {
|
|
||||||
/** the directory containing all source code (default: source) */
|
|
||||||
source: string;
|
|
||||||
/** the directory containing all the compiled files (default: lib) */
|
|
||||||
output: string;
|
|
||||||
buildSource: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const DEFAULT_VARIABLE: Variable = {
|
|
||||||
source: "build",
|
|
||||||
output: "lib",
|
|
||||||
buildSource: "src",
|
|
||||||
};
|
|
||||||
|
|
||||||
function buildOptions(context: PresetContext) {
|
|
||||||
const opts = context.custom.config?.esbuild as any;
|
|
||||||
if (!opts) {
|
|
||||||
throw new Error("esbuild options missing!");
|
|
||||||
}
|
|
||||||
|
|
||||||
return { esbuildOptions: resolveDirective(opts, context).stringifiedConfig };
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the list of templates provided by this preset
|
|
||||||
* @returns list of preset templates
|
|
||||||
*/
|
|
||||||
export default async function (context: PresetContext): Promise<PresetAsset> {
|
|
||||||
let name: string = context.custom.config?.pluginName as unknown as string;
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
const pkg = await readPackage();
|
|
||||||
name = pkg.name.split("plugin-").pop() as string;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
extends: ["presetter-preset-strict"],
|
|
||||||
template: {
|
|
||||||
"build.js": (context) => {
|
|
||||||
const content = loadFile(resolve(TEMPLATES, "build.js"), "text");
|
|
||||||
const variable = buildOptions(context);
|
|
||||||
|
|
||||||
return template(content, variable);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
scripts: resolve(TEMPLATES, "scripts.yaml"),
|
|
||||||
noSymlinks: ["build.js"],
|
|
||||||
supplementaryConfig: {
|
|
||||||
"gitignore": ["build.js"],
|
|
||||||
"tsconfig": {
|
|
||||||
compilerOptions: {
|
|
||||||
moduleResolution: "nodenext",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"tsconfig.build": {
|
|
||||||
include: ["{buildSource}"],
|
|
||||||
compilerOptions: {
|
|
||||||
outDir: "{source}",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"esbuild": {
|
|
||||||
entryPoints: ["{source}/index.ts"],
|
|
||||||
outfile: `{output}/${name}.js`,
|
|
||||||
format: "cjs",
|
|
||||||
bundle: true,
|
|
||||||
platform: "node",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
import esbuild from "esbuild";
|
|
||||||
|
|
||||||
esbuild.buildSync({esbuildOptions});
|
|
|
@ -1,6 +0,0 @@
|
||||||
# replace the `prepare` template from presetter-preset
|
|
||||||
# so that the build procedure will not be triggered upon package installation
|
|
||||||
build: cross-env NODE_ENV=production run-s clean build:typescript:* build:esbuild
|
|
||||||
build:esbuild: node build.js
|
|
||||||
develop: cross-env NODE_ENV=development run-s "build:esbuild -- --watch {@}" --
|
|
||||||
clean:buildOutput: shx rm -rf {source}
|
|
Loading…
Reference in New Issue