View .noderalis.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ~/.noderalis.ts | |
import { ProjectConfiguration } from '@noderalis/core'; | |
import { CleanWebpackPlugin } from 'clean-webpack-plugin'; | |
console.log('Success!!!'); | |
ProjectConfiguration.create({ | |
builds: [ | |
{ | |
entry: async () => ProjectConfiguration.workspace('@noderalis/cli'), // C:\...\noderalis\packages\noderalis-cli\sources\index.ts |
View ProjectConfiguration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ~/packages/noderalis-core/sources/ProjectConfiguration.ts | |
import { createRequire, createRequireFromPath } from 'module'; | |
require(path.resolve(__dirname, `../../../.pnp.js`)).setup(); | |
const requireAbs = (createRequire || createRequireFromPath)( | |
path.resolve(__dirname, './ProjectConfiguration.js') | |
); | |
async function requireConfig() { | |
const rootDir = await this.findProjectCwd(process.cwd(), true); |
View cli.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Cli } from 'clipanion'; | |
import { Readable, Writable } from 'stream'; | |
import { readdirSync } from 'fs'; | |
import { join } from 'path'; | |
export type CommandContext = { | |
cwd: string; | |
quiet: boolean; | |
stdin: Readable; | |
stdout: Writable; |
View BaseCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/tools/BaseCommand.ts | |
import { Command } from 'clipanion'; | |
import { CommandContext } from '..'; | |
/** | |
* The BaseCommand allows us to add behind-the-scenes functionality, | |
* while also allowing us to now have to add Command<CommandContext> | |
* to every command manually. | |
*/ | |
export abstract class BaseCommand extends Command<CommandContext> { |
View typescript.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import TsCheckerPlugin from "fork-ts-checker-webpack-plugin"; | |
import { resolve } from "path"; | |
import { Configuration } from "webpack"; | |
import { cpus } from "os"; | |
const PnpPlugin = require("pnp-webpack-plugin"); | |
const isProductionBuild: boolean = process.env.NODE_ENV == "production"; | |
const config: Configuration = { | |
entry: { |
View pnp.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Configuration } from "webpack"; | |
import { resolve } from "path"; | |
// Unfortunately pnpwp lacks TypeScript typings. | |
const PnpPlugin = require("pnp-webpack-plugin"); | |
const isProductionBuild: boolean = process.env.NODE_ENV == "production"; | |
const config: Configuration = { | |
entry: { | |
app: resolve(__dirname, "path-to-your-file.js"), |
View base.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Configuration } from "webpack"; | |
import { resolve } from "path"; | |
/** Check if we're using development or production. */ | |
const isProductionBuild: boolean = process.env.NODE_ENV == "production"; | |
/** A basic Webpack config, using some TypeScript sytactic sugar. */ | |
const config: Configuration = { | |
// Here we name our entry "app", you can also add others with any non-reserved names. | |
entry: { |
View package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "webpack-starter", | |
"version": "1.0.0", | |
"private": true, | |
"scripts": { | |
"build": "NODE_ENV=production && yarn _webpack", | |
"start": "node ./dist/file-example.js", | |
"_webpack": "webpack-cli --config ./config/webpack.config.ts" | |
} | |
} |
View webpack.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { CleanWebpackPlugin as CleanPlugin } from "clean-webpack-plugin"; | |
import TsCheckerPlugin from "fork-ts-checker-webpack-plugin"; | |
import { cpus } from "os"; | |
import { resolve } from "path"; | |
import { Configuration } from "webpack"; | |
const PnpPlugin = require("pnp-webpack-plugin"); | |
/** Name of the entry and output file. */ | |
const simpleEntryName = "file-example"; | |
/** Determine if this a production build. */ |
View fresh-install.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ===================================================================== | |
# Copyright 2019 - Present TheGrimSilence | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
NewerOlder