Skip to content

Commit

Permalink
Extract default sass plugin from heft to its own heft-sass-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasb committed Jul 19, 2021
1 parent 6bcb88c commit a5f16cc
Show file tree
Hide file tree
Showing 25 changed files with 273 additions and 102 deletions.
4 changes: 0 additions & 4 deletions apps/heft/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
"fast-glob": "~3.2.4",
"glob": "~7.0.5",
"glob-escape": "~0.0.2",
"node-sass": "5.0.0",
"postcss": "7.0.32",
"postcss-modules": "~1.5.0",
"prettier": "~2.3.0",
"semver": "~7.3.0",
"tapable": "1.1.3",
Expand All @@ -60,7 +57,6 @@
"@types/glob": "7.1.1",
"@types/heft-jest": "1.0.1",
"@types/node": "10.17.13",
"@types/node-sass": "4.11.1",
"@types/semver": "7.3.5",
"colors": "~1.2.1",
"tslint": "~5.20.1",
Expand Down
2 changes: 0 additions & 2 deletions apps/heft/src/pluginFramework/PluginManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { DeleteGlobsPlugin } from '../plugins/DeleteGlobsPlugin';
import { CopyStaticAssetsPlugin } from '../plugins/CopyStaticAssetsPlugin';
import { RunScriptPlugin } from '../plugins/RunScriptPlugin';
import { ApiExtractorPlugin } from '../plugins/ApiExtractorPlugin/ApiExtractorPlugin';
import { SassTypingsPlugin } from '../plugins/SassTypingsPlugin/SassTypingsPlugin';
import { ProjectValidatorPlugin } from '../plugins/ProjectValidatorPlugin';
import { ToolPackageResolver } from '../utilities/ToolPackageResolver';
import { NodeServicePlugin } from '../plugins/NodeServicePlugin';
Expand Down Expand Up @@ -53,7 +52,6 @@ export class PluginManager {
this._applyPlugin(new DeleteGlobsPlugin());
this._applyPlugin(new RunScriptPlugin());
this._applyPlugin(new ApiExtractorPlugin(taskPackageResolver));
this._applyPlugin(new SassTypingsPlugin());
this._applyPlugin(new ProjectValidatorPlugin());
this._applyPlugin(new NodeServicePlugin());
}
Expand Down
47 changes: 0 additions & 47 deletions apps/heft/src/templates/sass.json

This file was deleted.

23 changes: 0 additions & 23 deletions apps/heft/src/utilities/CoreConfigFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { IApiExtractorPluginConfiguration } from '../plugins/ApiExtractorPlugin/
import { ITypeScriptConfigurationJson } from '../plugins/TypeScriptPlugin/TypeScriptPlugin';
import { HeftConfiguration } from '../configuration/HeftConfiguration';
import { Terminal } from '@rushstack/node-core-library';
import { ISassConfigurationJson } from '../plugins/SassTypingsPlugin/SassTypingsPlugin';
import { INodeServicePluginConfiguration } from '../plugins/NodeServicePlugin';

export enum HeftEvent {
Expand Down Expand Up @@ -125,7 +124,6 @@ export class CoreConfigFiles {
private static _nodeServiceConfigurationLoader:
| ConfigurationFile<INodeServicePluginConfiguration>
| undefined;
private static _sassConfigurationFileLoader: ConfigurationFile<ISassConfigurationJson> | undefined;

/**
* Returns the loader for the `config/heft.json` config file.
Expand Down Expand Up @@ -283,27 +281,6 @@ export class CoreConfigFiles {
return CoreConfigFiles._nodeServiceConfigurationLoader;
}

public static get sassConfigurationFileLoader(): ConfigurationFile<ISassConfigurationJson> {
const schemaPath: string = path.resolve(__dirname, '..', 'schemas', 'sass.schema.json');
CoreConfigFiles._sassConfigurationFileLoader = new ConfigurationFile<ISassConfigurationJson>({
projectRelativeFilePath: 'config/sass.json',
jsonSchemaPath: schemaPath,
jsonPathMetadata: {
'$.importIncludePaths.*': {
pathResolutionMethod: PathResolutionMethod.resolvePathRelativeToProjectRoot
},
'$.generatedTsFolder.*': {
pathResolutionMethod: PathResolutionMethod.resolvePathRelativeToProjectRoot
},
'$.srcFolder.*': {
pathResolutionMethod: PathResolutionMethod.resolvePathRelativeToProjectRoot
}
}
});

return CoreConfigFiles._sassConfigurationFileLoader;
}

private static _addEventActionToMap<TEventAction extends IHeftConfigurationJsonEventActionBase>(
eventAction: TEventAction,
map: Map<HeftEvent, TEventAction[]>
Expand Down
2 changes: 1 addition & 1 deletion apps/heft/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"typeRoots": ["./custom-typings", "./node_modules/@types/"],
"types": ["heft-jest", "node"]
},
"include": ["src/**/*.ts", "src/**/*.tsx", "./custom-typings/**/*.ts"]
"include": ["src/**/*.ts", "src/**/*.tsx"]
}
6 changes: 6 additions & 0 deletions build-tests/heft-sass-test/config/heft.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
* The path to the plugin package.
*/
"plugin": "@rushstack/heft-jest-plugin"
},
{
/**
* The path to the plugin package.
*/
"plugin": "@rushstack/heft-sass-plugin"
}
]
}
1 change: 1 addition & 0 deletions build-tests/heft-sass-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@rushstack/heft-jest-plugin": "workspace:*",
"@rushstack/heft-sass-plugin": "workspace:*",
"@rushstack/heft-webpack4-plugin": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/react-dom": "16.9.8",
Expand Down
4 changes: 4 additions & 0 deletions common/config/rush/browser-approved-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/approved-packages.schema.json",
"packages": [
{
"name": "@rushstack/heft-sass-plugin",
"allowedCategories": [ "tests" ]
},
{
"name": "react",
"allowedCategories": [ "tests" ]
Expand Down
45 changes: 37 additions & 8 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/config/rush/repo-state.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
"pnpmShrinkwrapHash": "f45464cdd2ef1f79ab3446b3edd2384175b1e967",
"pnpmShrinkwrapHash": "90d9a6f48b14750485b141fc7547965bcb69bb9f",
"preferredVersionsHash": "1fbc26d2c5b3248616b9edccd6bef064075243bc"
}
13 changes: 13 additions & 0 deletions common/reviews/api/heft-sass-plugin.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## API Report File for "@rushstack/heft-sass-plugin"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts

import type { IHeftPlugin } from '@rushstack/heft';

// @public (undocumented)
const _default: IHeftPlugin<void>;
export default _default;

```
10 changes: 10 additions & 0 deletions heft-plugins/heft-sass-plugin/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');

module.exports = {
extends: [
'@rushstack/eslint-config/profile/node-trusted-tool',
'@rushstack/eslint-config/mixins/friendly-locals'
],
parserOptions: { tsconfigRootDir: __dirname }
};
30 changes: 30 additions & 0 deletions heft-plugins/heft-sass-plugin/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# THIS IS A STANDARD TEMPLATE FOR .npmignore FILES IN THIS REPO.

# Ignore all files by default, to avoid accidentally publishing unintended files.
*

# Use negative patterns to bring back the specific things we want to publish.
!/bin/**
!/lib/**
!/lib-*/**
!/dist/**
!ThirdPartyNotice.txt

# Ignore certain patterns that should not get published.
/dist/*.stats.*
/lib/**/test/
/lib-*/**/test/
*.test.js

# NOTE: These don't need to be specified, because NPM includes them automatically.
#
# package.json
# README (and its variants)
# CHANGELOG (and its variants)
# LICENSE / LICENCE

#--------------------------------------------
# DO NOT MODIFY THE TEMPLATE ABOVE THIS LINE
#--------------------------------------------

# (Add your project-specific overrides here)
24 changes: 24 additions & 0 deletions heft-plugins/heft-sass-plugin/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@rushstack/heft-sass-plugin

Copyright (c) Microsoft Corporation. All rights reserved.

MIT License

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.
11 changes: 11 additions & 0 deletions heft-plugins/heft-sass-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# @rushstack/heft-sass-plugin

This is a Heft plugin for using node-sass during the "build" stage.

## Links

- [CHANGELOG.md](
https://github.com/microsoft/rushstack/blob/master/heft-plugins/heft-sass-plugin/CHANGELOG.md) - Find
out what's new in the latest version

Heft is part of the [Rush Stack](https://rushstack.io/) family of projects.
16 changes: 16 additions & 0 deletions heft-plugins/heft-sass-plugin/config/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",

"mainEntryPointFilePath": "<projectFolder>/lib/index.d.ts",
"apiReport": {
"enabled": true,
"reportFolder": "../../../common/reviews/api"
},
"docModel": {
"enabled": false
},
"dtsRollup": {
"enabled": true,
"betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts"
}
}
7 changes: 7 additions & 0 deletions heft-plugins/heft-sass-plugin/config/rig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// The "rig.json" file directs tools to look for their config files in an external package.
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",

"rigPackageName": "@rushstack/heft-node-rig"
}
Loading

0 comments on commit a5f16cc

Please sign in to comment.