diff --git a/apps/create-pipes/.eslintrc.cjs b/apps/create-pipes/.eslintrc.cjs deleted file mode 100644 index 1ca9c5011..000000000 --- a/apps/create-pipes/.eslintrc.cjs +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("@island.is/eslint-config")(__dirname); diff --git a/apps/create-pipes/.prettierrc.cjs b/apps/create-pipes/.prettierrc.cjs deleted file mode 100644 index 5081a0c05..000000000 --- a/apps/create-pipes/.prettierrc.cjs +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - ...require("@island.is/prettier-config"), -}; diff --git a/apps/create-pipes/.swcrc b/apps/create-pipes/.swcrc deleted file mode 100644 index dc47e12cb..000000000 --- a/apps/create-pipes/.swcrc +++ /dev/null @@ -1,21 +0,0 @@ -{ - "jsc": { - "target": "esnext", - "parser": { - "syntax": "typescript", - "dynamicImport": true - }, - "transform": { - "react": { - "pragma": "React.createElement", - "pragmaFrag": "React.Fragment", - "throwIfNamespace": true, - "development": false, - "useBuiltins": false - } - } - }, - "module": { - "type": "nodenext" - } -} diff --git a/apps/create-pipes/LICENSE b/apps/create-pipes/LICENSE deleted file mode 100644 index 0ced0f3a0..000000000 --- a/apps/create-pipes/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 island.is - -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: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/apps/create-pipes/README.md b/apps/create-pipes/README.md deleted file mode 100644 index cc4b1b8c6..000000000 --- a/apps/create-pipes/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# @island.is/create-pipes - -**Usage**: Intended to be used as a custom loader in a Node.js environment with ES module support for usage with Pipes. - -### Prerequisites - -Create personal token with `write:packages` permission. Copy the token generated. - -Insert into your your home directory (most likely /home/ on Unix and C:\Users on windows) `.npmrc` - -```yaml -//npm.pkg.github.com/:_authToken={YOUR_TOKEN} -@island.is:registry=https://npm.pkg.github.com/ -``` - -> Note: This is only while pipes is in heavy testing. - -### 🚀 Usage - -```sh - -npx @island.is/create-pipes example-app - -``` - -This should create a new folder called `example-app`. - -## 🛡️ License - -License is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. diff --git a/apps/create-pipes/build.ts b/apps/create-pipes/build.ts deleted file mode 100644 index c14781f9e..000000000 --- a/apps/create-pipes/build.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { rollup } from "rollup"; -import { builtinModules } from "node:module"; -import { dirname, join } from "node:path"; -import { fileURLToPath } from "node:url"; -import { readFileSync, writeFileSync } from "node:fs"; -import { mkdir } from "node:fs/promises"; -import { nodeResolve } from "@rollup/plugin-node-resolve"; -import { swc } from "rollup-plugin-swc3"; -import { preparePublishPackage } from "../../base/scripts/src/utils/publish.js"; -import { z } from "@island.is/pipes-core"; -import { copyFile } from "node:fs/promises"; - -const currentPath = fileURLToPath(dirname(import.meta.url)); -const packageJSON = JSON.parse(readFileSync(join(currentPath, "package.json"), "utf-8")); -const external = Object.keys({ ...packageJSON.dependencies, ...packageJSON.peerDependencies }); - -const createConfig = (input: string) => { - const externalPackages = [...builtinModules, ...builtinModules.map((e) => `node:${e}`), ...external]; - return { - input: input, - plugins: [nodeResolve()], - external(id) { - return externalPackages.includes(id); - }, - }; -}; -const mainConfig = (input: string, output: string) => { - const baseConfig = createConfig(input); - (baseConfig as any).output = { - sourcemap: false, - file: output, - format: "esm", - }; - baseConfig.plugins = [ - ...baseConfig.plugins, - swc({ - sourceMaps: false, - minify: false, - }), - ]; - return baseConfig as typeof baseConfig & { output: { sourcemap: true; file: string; format: "commonjs" | "module" } }; -}; - -const build = async (input: string, output: string) => { - const main = mainConfig(input, output); - await Promise.all([ - (async () => { - const bundle = await rollup(main); - await bundle.write(main.output); - await bundle.close(); - })(), - ]); -}; - -export const copyFiles = async () => { - const currentURL = dirname(fileURLToPath(import.meta.url)); - const toURL = join(currentURL, "dist"); - await mkdir(toURL, { recursive: true }); - const files: { from: string; to: string }[] = packageJSON.pipes.publishFiles - .filter((e: string) => !e.startsWith("dist")) - .map((e: string) => { - return { from: join(currentURL, e), to: join(toURL, e) }; - }); - await Promise.all( - files.map(({ from, to }) => { - copyFile(from, to); - }), - ); -}; -const promises = [ - build(join(currentPath, "src", "create-pipes.ts"), join(currentPath, "dist", "dist", "create-pipes.js")), - copyFiles(), -]; - -const version = z - .string() - .default(packageJSON.version, { - env: "RELEASE_VERSION", - arg: { - long: "releaseVersion", - }, - }) - .parse(undefined); - -await Promise.all(promises); -await preparePublishPackage(process.cwd(), version); - -const currentURL = dirname(fileURLToPath(import.meta.url)); -const distFile = join(currentURL, `dist/dist/create-pipes.js`); -const content = ["#!/usr/bin/env node", readFileSync(distFile, "utf-8")].join("\n"); -writeFileSync(distFile, content, "utf-8"); diff --git a/apps/create-pipes/package.json b/apps/create-pipes/package.json deleted file mode 100644 index bb81bbf39..000000000 --- a/apps/create-pipes/package.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "name": "@island.is/create-pipes", - "version": "0.1.0", - "packageManager": "yarn@4.0.0-rc.47", - "scripts": { - "build": "yarn node build.ts", - "test": "yarn node ../../base/scripts/src/test.tsx", - "lint": "yarn node ../../base/scripts/src/lint.tsx" - }, - "bin": "./dist/dist/create-pipes.js", - "type": "module", - "main": "./dist/dist/create-pipes.js", - "types": "./dist/dist/create-pipes.d.ts", - "source": "./src/dist/create-pipes.ts", - "dependencies": { - "@actions/core": "1.10.1", - "@alcalzone/ansi-tokenize": "0.1.3", - "@dagger.io/dagger": "0.9.3", - "@island.is/pipes-core": "workspace:*", - "@swc/core": "1.3.100", - "@types/react": "18.2.42", - "@types/react-reconciler": "0.28.8", - "ansi-escapes": "6.2.0", - "auto-bind": "5.0.1", - "boxen": "7.1.1", - "chalk": "5.3.0", - "ci-info": "4.0.0", - "cli-boxes": "3.0.0", - "cli-cursor": "4.0.0", - "cli-truncate": "4.0.0", - "code-excerpt": "4.0.0", - "date-fns": "2.30.0", - "glob": "10.3.10", - "indent-string": "5.0.0", - "is-ci": "3.0.1", - "is-inside-container": "1.0.0", - "jest-snapshot": "29.7.0", - "lodash": "4.17.21", - "mobx": "6.12.0", - "object-hash": "3.0.0", - "prettier": "3.0.3", - "react": "18.2.0", - "react-reconciler": "0.29.0", - "scheduler": "0.23.0", - "slice-ansi": "7.1.0", - "stack-utils": "2.0.6", - "string-width": "7.0.0", - "terminal-link": "3.0.0", - "tmp-promise": "3.0.3", - "ts-toolbelt": "9.6.0", - "type-fest": "4.8.3", - "typescript": "5.3.3", - "widest-line": "5.0.0", - "wrap-ansi": "9.0.0", - "xo": "0.56.0", - "yoga-wasm-web": "0.3.3" - }, - "pipes": { - "skipBuild": true, - "publishFields": [ - "name", - "main", - "bin", - "repository", - "type", - "types", - "packageManager", - "license", - "version", - "dependencies", - "repository" - ], - "publishFiles": [ - "dist/**", - "README.md", - "LICENSE" - ], - "buildWithRollup": true - }, - "devDependencies": { - "@island.is/eslint-config": "workspace:*", - "@island.is/prettier-config": "workspace:*", - "@island.is/scripts": "workspace:*", - "@island.is/tsconfig": "workspace:*", - "@island.is/tsconfig-build": "workspace:*", - "@swc/core": "1.3.100", - "@types/node": "20.10.4", - "eslint": "8.55.0", - "prettier": "3.0.3", - "rollup": "4.6.1", - "rollup-plugin-swc": "0.2.1", - "rollup-plugin-swc3": "0.11.0", - "typescript": "5.3.3" - }, - "license": "MIT", - "repository": { - "directory": "apps/create-pipes", - "type": "git", - "url": "https://github.com/island-is/pipes" - }, - "engines": { - "node": "20.5.1", - "yarn": "4.0.0-rc.47", - "npm": "please use yarn", - "pnpm": "please use yarn" - } -} diff --git a/apps/create-pipes/rollup.config.js b/apps/create-pipes/rollup.config.js deleted file mode 100644 index b76d6657b..000000000 --- a/apps/create-pipes/rollup.config.js +++ /dev/null @@ -1,51 +0,0 @@ -import { builtinModules } from "node:module"; -import { dirname, join } from "node:path"; -import { fileURLToPath } from "node:url"; -import { readFile } from "node:fs/promises"; - -const currentPath = fileURLToPath(dirname(import.meta.url)); -/** @type {{main: string, dist: string, source: string, dependencies: Record, peerDependencies: Record, types: string}} */ -const packageJSON = JSON.parse(await readFile(join(currentPath, "package.json"), "utf-8")); -const deps = Object.keys(packageJSON.dependencies).filter((e) => e !== "@island.is/dom"); -const input = join(currentPath, ...packageJSON.source.replace("./", "").split("/")); -const output = join(currentPath, ...packageJSON.main.replace("./", "").split("/")); -const types = join(currentPath, ...packageJSON.types.replace("./", "").split("/")); - -export const files = { - main: output, - source: input, - types, -}; -const config = { - input: files.source, - output: { - sourcemap: true, - file: files.main, - format: "esm", - }, - plugins: [ - { - name: "island.is-resolve", - resolveId(source) { - try { - const file = import.meta.resolve?.(source); - return file.replace("file:///", "/"); - } catch { - return null; - } - }, - }, - ], - external: [ - ...builtinModules.map((e) => `node:${e}`), - ...deps, - "mobx", - "yoga-wasm-web", - "@swc/core", - "glob", - "@dagger.io/dagger", - "@island.is/pipes-core", - ], -}; - -export default config; diff --git a/apps/create-pipes/src/const.ts b/apps/create-pipes/src/const.ts deleted file mode 100644 index ec488c5b8..000000000 --- a/apps/create-pipes/src/const.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { readFileSync } from "node:fs"; -import { dirname, join } from "node:path"; -import { fileURLToPath } from "node:url"; - -const rootDir = fileURLToPath(dirname(dirname(import.meta.url))); -const packageJSONPath = join(rootDir, "package.json"); -const packageJSON = JSON.parse(readFileSync(packageJSONPath, "utf-8")); - -const packageManager = packageJSON["packageManager"].split("yarn@")[1]; -const version = packageJSON["version"]; - -// TODO: This should be auto generated -export const YARN_VERSION = packageManager as string; -export const VERSION = version as string; diff --git a/apps/create-pipes/src/create-pipes.spec.ts b/apps/create-pipes/src/create-pipes.spec.ts deleted file mode 100644 index 373d976e1..000000000 --- a/apps/create-pipes/src/create-pipes.spec.ts +++ /dev/null @@ -1,38 +0,0 @@ -import assert from "node:assert"; -import fs from "node:fs"; -import os from "node:os"; -import path from "node:path"; -import { describe, it } from "node:test"; - -import { VERSION, YARN_VERSION } from "./const.js"; -import * as createPipes from "./main.js"; - -describe("create-pipes", () => { - describe("all versions are defined", () => { - assert(typeof YARN_VERSION === "string"); - assert(typeof VERSION === "string"); - }); - describe("getAppPaths", () => { - it("should return correct paths", () => { - const { appPath, srcPath } = createPipes.getAppPaths(process.cwd(), "myApp"); - assert.strictEqual(appPath, `${process.cwd()}/myApp`); - assert.strictEqual(srcPath, `${process.cwd()}/myApp/src`); - }); - }); - it("should create the app successfully", () => { - const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "create-pipes-")); - - createPipes.main(tempDir, "appName"); - const rootDir = path.join(tempDir, "appName"); - - assert(fs.existsSync(path.join(rootDir, "src", "ci.tsx"))); - assert(fs.existsSync(path.join(rootDir, "yarn.lock"))); - assert(fs.existsSync(path.join(rootDir, "package.json"))); - assert(fs.existsSync(path.join(rootDir, ".yarnrc.yml"))); - - const packageJsonContent = fs.readFileSync(path.join(rootDir, "package.json"), "utf8"); - assert(packageJsonContent.includes('"name": "appName"')); - - fs.rmdirSync(tempDir, { recursive: true }); - }); -}); diff --git a/apps/create-pipes/src/create-pipes.ts b/apps/create-pipes/src/create-pipes.ts deleted file mode 100644 index 26e2cf187..000000000 --- a/apps/create-pipes/src/create-pipes.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { main } from "./main.js"; - -main(); diff --git a/apps/create-pipes/src/env.ts b/apps/create-pipes/src/env.ts deleted file mode 100644 index 87675644e..000000000 --- a/apps/create-pipes/src/env.ts +++ /dev/null @@ -1,9 +0,0 @@ -export const createEnv = (): string => { - const NODE_ENV = [ - "NODE_OPTIONS=", - "--no-warnings=ExperimentalWarning", - "--enable-source-maps", - "--experimental-loader=@island.is/pipes-core/loader.mjs", - ].join(""); - return [`FORCE_COLOR=2`, NODE_ENV].join("\n"); -}; diff --git a/apps/create-pipes/src/gitignore.ts b/apps/create-pipes/src/gitignore.ts deleted file mode 100644 index 066f4b6b5..000000000 --- a/apps/create-pipes/src/gitignore.ts +++ /dev/null @@ -1,142 +0,0 @@ -export const gitignore = `### Node ### -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -.pnpm-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Snowpack dependency directory (https://snowpack.dev/) -web_modules/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional stylelint cache -.stylelintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variable files -.env -.env.development.local -.env.test.local -.env.production.local -.env.local - -# parcel-bundler cache (https://parceljs.org/) -.cache -.parcel-cache - -# Next.js build output -.next -out - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and not Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# vuepress v2.x temp and cache directory -.temp - -# Docusaurus cache and generated files -.docusaurus - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port - -# Stores VSCode versions used for testing VSCode extensions -.vscode-test - -# yarn v2 -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.* - -### Node Patch ### -# Serverless Webpack directories -.webpack/ - -# Optional stylelint cache - -# SvelteKit build / generate output -.svelte-kit - -# End of https://www.toptal.com/developers/gitignore/api/node -`; diff --git a/apps/create-pipes/src/main.ts b/apps/create-pipes/src/main.ts deleted file mode 100644 index db75a52f8..000000000 --- a/apps/create-pipes/src/main.ts +++ /dev/null @@ -1,63 +0,0 @@ -import fs from "node:fs"; -import path from "node:path"; - -import { z } from "@island.is/pipes-core"; - -import { VERSION, YARN_VERSION } from "./const.js"; -import { createEnv } from "./env.js"; -import { gitignore } from "./gitignore.js"; -import { PackageJSON } from "./package-json.js"; -import { sourceFile } from "./pipes.js"; -import { createYARNRC } from "./yarnrc.js"; - -import type { WriteFileOptions } from "node:fs"; - -export function getAppPaths(root: string, appName: string): { appPath: string; srcPath: string } { - const appPath = path.join(root, appName); - const srcPath = path.join(appPath, "src"); - return { appPath, srcPath }; -} - -export function createDirectories(path: string): void { - fs.mkdirSync(path, { recursive: true }); -} - -export function writeFile(filePath: string, content: string, encoding: WriteFileOptions = "utf-8"): void { - fs.writeFileSync(filePath, content, encoding); -} - -export function main(root = process.cwd(), appNameArg: string | undefined = undefined): void { - const appName = z - .string() - .default(appNameArg, { - arg: { - long: "appName", - positional: true, - }, - }) - .parse(undefined); - - const { appPath, srcPath } = getAppPaths(root, appName); - - createDirectories(srcPath); - - writeFile(path.join(srcPath, "ci.tsx"), sourceFile); - writeFile(path.join(appPath, "yarn.lock"), ""); - - const envPath = path.join(appPath, ".env.root"); - const gitignorePath = path.join(appPath, ".gitignore"); - const packageJsonPath = path.join(appPath, "package.json"); - const packageJsonContent = PackageJSON({ - name: appName, - yarnVersion: YARN_VERSION, - version: VERSION, - }); - writeFile(envPath, createEnv()); - writeFile(gitignorePath, gitignore); - writeFile(packageJsonPath, packageJsonContent); - - const yarnrcPath = path.join(appPath, ".yarnrc.yml"); - writeFile(yarnrcPath, createYARNRC()); - - console.log("App has been created successfully."); -} diff --git a/apps/create-pipes/src/package-json.ts b/apps/create-pipes/src/package-json.ts deleted file mode 100644 index c6cadc4b6..000000000 --- a/apps/create-pipes/src/package-json.ts +++ /dev/null @@ -1,24 +0,0 @@ -interface Props { - name: string; - version: string; - yarnVersion: string; -} -export const PackageJSON = ({ name, version, yarnVersion }: Props): string => { - return JSON.stringify( - { - name, - version: "0.0.1", - packageManager: `yarn@${yarnVersion}`, - type: "module", - scripts: { - dev: "node src/ci.tsx", - }, - dependencies: { - glob: "10.3.10", - "@island.is/pipes-core": version, - }, - }, - null, - 2, - ); -}; diff --git a/apps/create-pipes/src/pipes.ts b/apps/create-pipes/src/pipes.ts deleted file mode 100644 index 6d4a82055..000000000 --- a/apps/create-pipes/src/pipes.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const sourceFile = [ - 'import { createPipe } from "@island.is/pipes-core";', - "", - "await createPipe(({ createPipesCore }) => {", - " const mainContext = createPipesCore();", - " mainContext.addScript(() => {", - " console.log(`Hello world`);", - " });", - " return [mainContext];", - "});", - "", -].join("\n"); diff --git a/apps/create-pipes/src/yarnrc.ts b/apps/create-pipes/src/yarnrc.ts deleted file mode 100644 index fb0b87ad0..000000000 --- a/apps/create-pipes/src/yarnrc.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const createYARNRC = (): string => { - return ["injectEnvironmentFiles:", " - .env.root", "nmMode: hardlinks-local", "nodeLinker: node-modules"].join( - "\n", - ); -}; diff --git a/apps/create-pipes/tsconfig.build.json b/apps/create-pipes/tsconfig.build.json deleted file mode 100644 index b79e3b7fa..000000000 --- a/apps/create-pipes/tsconfig.build.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "@island.is/tsconfig-build", - "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.spec.ts", "src/**/*.spec.tsx"], - "compilerOptions": { - "declarationDir": "./dist", - "outDir": "./dist", - "declaration": true - } -} diff --git a/apps/create-pipes/tsconfig.json b/apps/create-pipes/tsconfig.json deleted file mode 100644 index 2b7064c2c..000000000 --- a/apps/create-pipes/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "src/files/*"], - "extends": "@island.is/tsconfig" -} diff --git a/apps/pipes/src/loader/libs/convert-file-path.ts b/apps/pipes/src/loader/libs/convert-file-path.ts index d42e6beef..f3873d13c 100644 --- a/apps/pipes/src/loader/libs/convert-file-path.ts +++ b/apps/pipes/src/loader/libs/convert-file-path.ts @@ -1,4 +1,4 @@ -import { join } from "node:path"; +import { resolve } from "node:path"; import { convertURL } from "./convert-url.js"; import { isRelativePath } from "./is-relative-path.js"; @@ -15,7 +15,7 @@ export const convertFilePath = (path: string, parent: string | null | undefined) throw new Error("Invalid url!"); } if (filePath && isRelativePath(filePath)) { - return join(parent || process.cwd(), filePath); + return resolve(parent || process.cwd(), filePath); } return filePath; }; diff --git a/apps/pipes/src/loader/libs/is-relative-path.ts b/apps/pipes/src/loader/libs/is-relative-path.ts index 252804080..b8d708703 100644 --- a/apps/pipes/src/loader/libs/is-relative-path.ts +++ b/apps/pipes/src/loader/libs/is-relative-path.ts @@ -1,3 +1,3 @@ export const isRelativePath = (path: string): boolean => { - return !/^(?:\/|[a-zA-Z]:\\|https?:\/\/|data:|blob:)/.test(path); + return path.startsWith("./") || path.startsWith("../"); }; diff --git a/apps/pipes/src/loader/resolve.spec.ts b/apps/pipes/src/loader/resolve.spec.ts index a20291b1d..270687380 100644 --- a/apps/pipes/src/loader/resolve.spec.ts +++ b/apps/pipes/src/loader/resolve.spec.ts @@ -20,6 +20,31 @@ describe("resolve", () => { assert.strictEqual(result.shortCircuit, true); }); + it("should return source URL for local file", async () => { + const nextResolve = mock.fn(() => ({ url: "node:fs", shortCircuit: false })) as any; + const result = await resolve("./src/loader/resolve.ts", {}, nextResolve); + + assert.strictEqual(result.url.startsWith("file:///"), true); + assert.strictEqual(result.url.endsWith("resolve.ts"), true); + assert.strictEqual(result.shortCircuit, true); + }); + + it("should return source URL for local file with js ending", async () => { + const nextResolve = mock.fn(() => ({ url: "node:fs", shortCircuit: false })) as any; + const result = await resolve("./src/loader/resolve.js", {}, nextResolve); + assert.strictEqual(result.url.startsWith("file:///"), true); + assert.strictEqual(result.url.endsWith("resolve.ts"), true); + assert.strictEqual(result.shortCircuit, true); + }); + + it("should return source URL for local file with …", async () => { + const nextResolve = mock.fn(() => ({ url: "node:fs", shortCircuit: false })) as any; + const result = await resolve("../pipes/src/config.ts", {}, nextResolve); + assert.strictEqual(result.url.startsWith("file:///"), true); + assert.strictEqual(result.url.endsWith("config.ts"), true); + assert.strictEqual(result.shortCircuit, true); + }); + it("should delegate to nextResolve if file does not need to be compiled", async () => { const nextResolve = mock.fn(() => ({ url: "some-module", shortCircuit: false })) as any; const result = await resolve("some-module", {}, nextResolve); diff --git a/apps/pipes/src/loader/resolve.ts b/apps/pipes/src/loader/resolve.ts index cbe44e4c3..24c07a3b4 100644 --- a/apps/pipes/src/loader/resolve.ts +++ b/apps/pipes/src/loader/resolve.ts @@ -54,7 +54,6 @@ export const resolve: ResolveFn = async (url, context, nextResolve) => { * b) the file does not exist but a file with .ts .tsx ending does */ const compileFile = await shouldCompile(filePath); - /** Ignore files who do not meet those conditions */ if (!compileFile && (await doesFileExists(filePath))) { const fileIsDirectory = await isDirectory(filePath); diff --git a/base/scripts/src/build-all.tsx b/base/scripts/src/build-all.tsx index a5031741a..43695c834 100644 --- a/base/scripts/src/build-all.tsx +++ b/base/scripts/src/build-all.tsx @@ -55,11 +55,4 @@ const getAppPath = (type: "app" | "module", name: string) => { throw new Error("Invalid type"); }; -await build(getAppPath("app", "pipes"), "pipes-core").then(() => { - return Promise.all([ - build(getAppPath("app", "create-pipes"), "create-pipes"), - build(getAppPath("module", "pipes-module-node"), "pipes-module-node").then(() => { - return build(getAppPath("module", "pipes-module-github"), "pipes-module-github"); - }), - ]); -}); +await build(getAppPath("app", "pipes"), "pipes-core"); diff --git a/ci/src/build/build.tsx b/ci/src/build/build.tsx index d28388d01..217f518de 100644 --- a/ci/src/build/build.tsx +++ b/ci/src/build/build.tsx @@ -42,7 +42,7 @@ const createBuildContext = (props: Props) => { args: ["run", value], relativeCwd: props.relativeWorkDir, env: { - releaseVersion: GlobalConfig.releaseVersion as string, + releaseVersion: GlobalConfig.releaseVersion, }, }); if (stateValue.state === "Error") { @@ -92,7 +92,7 @@ const createBuildContext = (props: Props) => { publishContext.addScript(async (context) => { if (props.createRelease) { await context.githubRelease({ - version: GlobalConfig.releaseVersion as string, + version: GlobalConfig.releaseVersion, body: GlobalConfig.releaseChangelog as string, }); } @@ -100,13 +100,13 @@ const createBuildContext = (props: Props) => { await Promise.all([ context.nodePublish({ email: "jonorn@gmail.com", - version: GlobalConfig.releaseVersion as string, + version: GlobalConfig.releaseVersion, token: GlobalConfig.npmAuthToken, relativeWorkDir: "./dist", unpublish: "ifExists", access: "public", }), - context.githubUploadArtifact({ files, name: props.name, version: GlobalConfig.releaseVersion as string }), + context.githubUploadArtifact({ files, name: props.name, version: GlobalConfig.releaseVersion }), ]); }); @@ -133,20 +133,4 @@ export const buildCoreContext = createBuildContext({ required: devImageInstallContext, relativeWorkDir: "./apps/pipes", createRelease: true, - dependendants: [ - { - name: "create-pipes", - relativeWorkDir: "./apps/create-pipes", - }, - { - name: "pipes-module-node", - relativeWorkDir: "./pipes-modules/pipes-module-node", - dependendants: [ - { - name: "pipes-module-github", - relativeWorkDir: "./pipes-modules/pipes-module-github", - }, - ], - }, - ], }); diff --git a/yarn.lock b/yarn.lock index 6c927ab44..435e8a519 100644 --- a/yarn.lock +++ b/yarn.lock @@ -907,66 +907,6 @@ __metadata: languageName: unknown linkType: soft -"@island.is/create-pipes@workspace:apps/create-pipes": - version: 0.0.0-use.local - resolution: "@island.is/create-pipes@workspace:apps/create-pipes" - dependencies: - "@actions/core": "npm:1.10.1" - "@alcalzone/ansi-tokenize": "npm:0.1.3" - "@dagger.io/dagger": "npm:0.9.3" - "@island.is/eslint-config": "workspace:*" - "@island.is/pipes-core": "workspace:*" - "@island.is/prettier-config": "workspace:*" - "@island.is/scripts": "workspace:*" - "@island.is/tsconfig": "workspace:*" - "@island.is/tsconfig-build": "workspace:*" - "@swc/core": "npm:1.3.100" - "@types/node": "npm:20.10.4" - "@types/react": "npm:18.2.42" - "@types/react-reconciler": "npm:0.28.8" - ansi-escapes: "npm:6.2.0" - auto-bind: "npm:5.0.1" - boxen: "npm:7.1.1" - chalk: "npm:5.3.0" - ci-info: "npm:4.0.0" - cli-boxes: "npm:3.0.0" - cli-cursor: "npm:4.0.0" - cli-truncate: "npm:4.0.0" - code-excerpt: "npm:4.0.0" - date-fns: "npm:2.30.0" - eslint: "npm:8.55.0" - glob: "npm:10.3.10" - indent-string: "npm:5.0.0" - is-ci: "npm:3.0.1" - is-inside-container: "npm:1.0.0" - jest-snapshot: "npm:29.7.0" - lodash: "npm:4.17.21" - mobx: "npm:6.12.0" - object-hash: "npm:3.0.0" - prettier: "npm:3.0.3" - react: "npm:18.2.0" - react-reconciler: "npm:0.29.0" - rollup: "npm:4.6.1" - rollup-plugin-swc: "npm:0.2.1" - rollup-plugin-swc3: "npm:0.11.0" - scheduler: "npm:0.23.0" - slice-ansi: "npm:7.1.0" - stack-utils: "npm:2.0.6" - string-width: "npm:7.0.0" - terminal-link: "npm:3.0.0" - tmp-promise: "npm:3.0.3" - ts-toolbelt: "npm:9.6.0" - type-fest: "npm:4.8.3" - typescript: "npm:5.3.3" - widest-line: "npm:5.0.0" - wrap-ansi: "npm:9.0.0" - xo: "npm:0.56.0" - yoga-wasm-web: "npm:0.3.3" - bin: - create-pipes: ./dist/dist/create-pipes.js - languageName: unknown - linkType: soft - "@island.is/eslint-config@workspace:*, @island.is/eslint-config@workspace:base/eslint-config": version: 0.0.0-use.local resolution: "@island.is/eslint-config@workspace:base/eslint-config" @@ -1736,16 +1676,6 @@ __metadata: languageName: node linkType: hard -"@rollup/pluginutils@npm:^4.1.2": - version: 4.2.1 - resolution: "@rollup/pluginutils@npm:4.2.1" - dependencies: - estree-walker: "npm:^2.0.1" - picomatch: "npm:^2.2.2" - checksum: 503a6f0a449e11a2873ac66cfdfb9a3a0b77ffa84c5cad631f5e4bc1063c850710e8d5cd5dab52477c0d66cda2ec719865726dbe753318cd640bab3fff7ca476 - languageName: node - linkType: hard - "@rollup/pluginutils@npm:^5.0.1, @rollup/pluginutils@npm:^5.0.2": version: 5.0.4 resolution: "@rollup/pluginutils@npm:5.0.4" @@ -5116,7 +5046,7 @@ __metadata: languageName: node linkType: hard -"estree-walker@npm:^2.0.1, estree-walker@npm:^2.0.2": +"estree-walker@npm:^2.0.2": version: 2.0.2 resolution: "estree-walker@npm:2.0.2" checksum: b02109c5d46bc2ed47de4990eef770f7457b1159a229f0999a09224d2b85ffeed2d7679cffcff90aeb4448e94b0168feb5265b209cdec29aad50a3d6e93d21e2 @@ -6335,17 +6265,6 @@ __metadata: languageName: node linkType: hard -"is-ci@npm:3.0.1": - version: 3.0.1 - resolution: "is-ci@npm:3.0.1" - dependencies: - ci-info: "npm:^3.2.0" - bin: - is-ci: bin.js - checksum: 192c66dc7826d58f803ecae624860dccf1899fc1f3ac5505284c0a5cf5f889046ffeb958fa651e5725d5705c5bcb14f055b79150ea5fcad7456a9569de60260e - languageName: node - linkType: hard - "is-core-module@npm:^2.11.0, is-core-module@npm:^2.12.0, is-core-module@npm:^2.5.0": version: 2.12.1 resolution: "is-core-module@npm:2.12.1" @@ -8318,7 +8237,7 @@ __metadata: languageName: node linkType: hard -"picomatch@npm:^2.0.4, picomatch@npm:^2.2.2, picomatch@npm:^2.2.3, picomatch@npm:^2.3.1": +"picomatch@npm:^2.0.4, picomatch@npm:^2.2.3, picomatch@npm:^2.3.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" checksum: 60c2595003b05e4535394d1da94850f5372c9427ca4413b71210f437f7b2ca091dbd611c45e8b37d10036fa8eade25c1b8951654f9d3973bfa66a2ff4d3b08bc @@ -8905,18 +8824,6 @@ __metadata: languageName: node linkType: hard -"rollup-plugin-swc@npm:0.2.1": - version: 0.2.1 - resolution: "rollup-plugin-swc@npm:0.2.1" - dependencies: - "@rollup/pluginutils": "npm:^4.1.2" - peerDependencies: - "@swc/core": ">=1.0" - rollup: ">=1.5.0" - checksum: 0af3d718f001d6dd7957626e26d7a83959a2febc6f1698066d68e8d1f4bab4ff4d87e047fc794b51f531490c1d1d01870d993de067758c95281030ba781c47ef - languageName: node - linkType: hard - "rollup-plugin-ts@npm:3.4.5": version: 3.4.5 resolution: "rollup-plugin-ts@npm:3.4.5" @@ -9104,7 +9011,7 @@ __metadata: languageName: node linkType: hard -"scheduler@npm:0.23.0, scheduler@npm:^0.23.0": +"scheduler@npm:^0.23.0": version: 0.23.0 resolution: "scheduler@npm:0.23.0" dependencies: