Compare commits

..

27 Commits

Author SHA1 Message Date
semantic-release-bot c402790f57 chore(release): 0.1.0-develop.9 [skip ci]
# [0.1.0-develop.9](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.8...v0.1.0-develop.9) (2023-07-09)

### Bug Fixes

* add npmPublish override to semantic release ([118c9a4](118c9a435f))
2023-07-09 15:48:04 +00:00
Derrick Hammer a8e7bc45c9
Merge remote-tracking branch 'origin/develop' into develop 2023-07-09 11:47:19 -04:00
Derrick Hammer 118c9a435f
fix: add npmPublish override to semantic release 2023-07-09 11:47:06 -04:00
semantic-release-bot 8a821734ba chore(release): 0.1.0-develop.8 [skip ci]
# [0.1.0-develop.8](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.7...v0.1.0-develop.8) (2023-07-07)

### Bug Fixes

* set esbuild mainFields and conditions to prioritize cjs ([b1d4070](b1d4070193))
2023-07-07 08:10:05 +00:00
Derrick Hammer c522222a21
Merge remote-tracking branch 'origin/develop' into develop 2023-07-07 04:09:14 -04:00
Derrick Hammer b1d4070193
fix: set esbuild mainFields and conditions to prioritize cjs 2023-07-07 04:09:03 -04:00
semantic-release-bot a7b7bd289e chore(release): 0.1.0-develop.7 [skip ci]
# [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-07-07)
2023-07-07 07:50:17 +00:00
Derrick Hammer 978292521c
Merge remote-tracking branch 'origin/develop' into develop 2023-07-07 03:49:25 -04:00
semantic-release-bot 4de7f45c65
refactor: only extend @lumeweb/node-library-preset 2023-07-07 03:49:20 -04:00
semantic-release-bot 66eb93db34 chore(release): 0.1.0-develop.6 [skip ci]
# [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-07-07)
2023-07-07 07:41:24 +00:00
Derrick Hammer 6b73013f21
dep: add @lumeweb/node-library-preset 2023-07-07 03:40:00 -04:00
semantic-release-bot 6b89640efe chore(release): 0.1.0-develop.5 [skip ci]
# [0.1.0-develop.5](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.4...v0.1.0-develop.5) (2023-07-07)
2023-07-07 07:07:29 +00:00
Derrick Hammer f54dbc4a04
Merge remote-tracking branch 'origin/develop' into develop 2023-07-07 03:06:32 -04:00
Derrick Hammer 83a399ba50
dep: add presetter-preset-strict 2023-07-07 03:06:29 -04:00
semantic-release-bot 0733600951 chore(release): 0.1.0-develop.4 [skip ci]
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.3...v0.1.0-develop.4) (2023-07-07)

### Bug Fixes

* index file is js not ts ([d5b4877](d5b48773a9))
2023-07-07 05:08:15 +00:00
Derrick Hammer 93f4c59b5e
Merge remote-tracking branch 'origin/develop' into develop 2023-07-07 01:07:18 -04:00
Derrick Hammer d5b48773a9
fix: index file is js not ts 2023-07-07 01:07:14 -04:00
semantic-release-bot 5abd8b5b76 chore(release): 0.1.0-develop.3 [skip ci]
# [0.1.0-develop.3](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-07-07)

### Bug Fixes

* variable not exported ([bdf43b3](bdf43b3d8e))
2023-07-07 05:05:43 +00:00
Derrick Hammer e7e53be40e
Merge remote-tracking branch 'origin/develop' into develop 2023-07-07 01:04:48 -04:00
Derrick Hammer bdf43b3d8e
fix: variable not exported 2023-07-07 01:04:42 -04:00
semantic-release-bot 636a33ca42 chore(release): 0.1.0-develop.2 [skip ci]
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-07-07)
2023-07-07 04:41:36 +00:00
Derrick Hammer a7d0ba85d0
Merge remote-tracking branch 'origin/develop' into develop 2023-07-07 00:40:53 -04:00
Derrick Hammer 10085f7a03
dep: add esbuild 2023-07-07 00:40:48 -04:00
semantic-release-bot 7df2ed737b chore(release): 0.1.0-develop.1 [skip ci]
# [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](3a8855abe2))
2023-07-07 04:36:34 +00:00
Derrick Hammer eee3a0df06
chore: update LICENSE 2023-07-07 00:35:08 -04:00
Derrick Hammer c9a68b2876
ci: setup 2023-07-07 00:33:29 -04:00
Derrick Hammer 3a8855abe2
feat: initial version 2023-07-07 00:28:07 -04:00
9 changed files with 18374 additions and 1 deletions

13
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: Build/Publish
on:
push:
branches:
- master
- develop
- develop-*
jobs:
main:
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
secrets: inherit

5
.presetterrc.json Normal file
View File

@ -0,0 +1,5 @@
{
"preset": [
"@lumeweb/node-library-preset"
]
}

42
CHANGELOG.md Normal file
View File

@ -0,0 +1,42 @@
# [0.1.0-develop.9](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.8...v0.1.0-develop.9) (2023-07-09)
### Bug Fixes
* add npmPublish override to semantic release ([118c9a4](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/commit/118c9a435f09afea1c2cd7015f4efd2b78350147))
# [0.1.0-develop.8](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.7...v0.1.0-develop.8) (2023-07-07)
### Bug Fixes
* set esbuild mainFields and conditions to prioritize cjs ([b1d4070](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/commit/b1d407019364186a82660b93381d46205d4c82fe))
# [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-07-07)
# [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-07-07)
# [0.1.0-develop.5](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.4...v0.1.0-develop.5) (2023-07-07)
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.3...v0.1.0-develop.4) (2023-07-07)
### Bug Fixes
* index file is js not ts ([d5b4877](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/commit/d5b48773a98b0eca99bea8f03ac867bd10eeb0f7))
# [0.1.0-develop.3](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-07-07)
### Bug Fixes
* variable not exported ([bdf43b3](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/commit/bdf43b3d8eb5ee484c4078de71b29ae368c36ab2))
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/presetter-relay-plugin-preset/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-07-07)
# [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))

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) <year> <copyright holders> Copyright (c) 2023 Hammer TechnologiesLLC
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:

18177
npm-shrinkwrap.json generated Normal file

File diff suppressed because it is too large Load Diff

32
package.json Normal file
View File

@ -0,0 +1,32 @@
{
"name": "@lumeweb/presetter-relay-plugin-preset",
"version": "0.1.0-develop.9",
"type": "module",
"main": "lib/index.js",
"repository": {
"type": "git",
"url": "gitea@git.lumeweb.com:LumeWeb/presetter-relay-plugin-preset.git"
},
"devDependencies": {
"presetter": "^4.0.1"
},
"readme": "ERROR: No README data found!",
"scripts": {
"prepare": "presetter bootstrap",
"build": "run build",
"semantic-release": "semantic-release"
},
"dependencies": {
"@lumeweb/node-library-preset": "^0.2.7",
"esbuild": "^0.18.11",
"read-pkg": "^8.0.0",
"semantic-release": "^21.0.7"
},
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"templates"
]
}

95
src/index.ts Normal file
View File

@ -0,0 +1,95 @@
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: ["@lumeweb/node-library-preset"],
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.js"],
outfile: `{output}/${name}.js`,
format: "cjs",
bundle: true,
platform: "node",
mainFields: ["main", "module"],
conditions: ["require"],
},
"release": {
plugins: {
3: ["@semantic-release/npm", { npmPublish: false }],
},
},
},
variable: DEFAULT_VARIABLE,
};
}

3
templates/build.js Normal file
View File

@ -0,0 +1,3 @@
import esbuild from "esbuild";
esbuild.buildSync({esbuildOptions});

6
templates/scripts.yaml Normal file
View File

@ -0,0 +1,6 @@
# 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}